package com.lhj.bootdemo.bitmap;

import com.google.common.base.Charsets;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

/**
 * @author lhj
 * @version 1.0
 * @date 2022/4/18 9:08 下午
 * @description: 布隆过滤器的使用
 */

public class BuLongTest {

    //元素个数 100万
    public static final int insertions = 1000000;
    public static void main(String[] args) {

        BloomFilter<String> charSequenceBloomFilter = BloomFilter.create(Funnels.stringFunnel(Charsets.UTF_8), insertions, 0.03D);

        boolean abc = charSequenceBloomFilter.put("abc");

        boolean dd = charSequenceBloomFilter.mightContain("dd");
    }
}
